// 路由和菜单配置

import React, { Component, Fragment, useState, lazy } from "react";
import {
    DesktopOutlined,
    PieChartOutlined,
    FileOutlined,
    TeamOutlined,
    LaptopOutlined,
    NotificationOutlined,
    UserOutlined,
} from '@ant-design/icons';


// 菜单与路由的配置文件
const config = [
    {
        title: '控制台', // 菜单名称
        icon: <UserOutlined />,
        key: '/index', // url不可以重复
        exact: true,
        component: lazy(() => import('../page/home')), // 有component就表示此项为菜单与路由,若没有component就表示此项只是菜单
        disvisible: false, // 不可见,不是菜单;此项配置为true表示只是路由不是菜单
        role: ["user", "information", "product"] // todo 没做
    },
    {
        title: '用户管理',
        icon: <UserOutlined />,
        key: '/user', // 菜单
        role: ["information", "user"], // 角色 
        child: [{
            key: '/user/list',
            title: '用户列表',
            component: lazy(() => import('../page/one')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/user/add',
            title: '添加用户',
            component: lazy(() => import('../page/one1')),
            icon: <UserOutlined />,
            role: ["user"]
        }
        ]
    },
    {
        title: '部门管理',
        icon: <UserOutlined />,
        key: '/department',
        role: ["user"],
        child: [
            {
                key: '/department/list',
                title: '部门列表',
                icon: <UserOutlined />,
                role: ["user"],
                child: [
                    {
                        key: '/department/a',
                        title: '部门列表1',
                        icon: <UserOutlined />,
                        role: ["user"],
                        child: [
                            {
                                key: '/department/b',
                                title: '部门列表1-1',
                                icon: <UserOutlined />,
                                role: ["user"],
                                child: [
                                    {
                                        key: '/department/bb',
                                        title: '部门列表1-1-1',
                                        component: lazy(() => import('../page/one2')),
                                        icon: <UserOutlined />,
                                        role: ["user"]
                                    },
                                    {
                                        key: '/department/cc',
                                        title: '添加部门1-1-2',
                                        component: lazy(() => import('../page/one3')),
                                        icon: <UserOutlined />,
                                        role: ["user"]
                                    },
                                ]
                            },
                            {
                                key: '/department/c',
                                component: lazy(() => import('../page/one4')),
                                title: '添加部门1-2',
                                icon: <UserOutlined />,
                                role: ["user"]
                            },
                        ]
                    },
                    {
                        key: '/department/d',
                        component: lazy(() => import('../page/one5')),
                        title: '添加部门2',
                        icon: <UserOutlined />,
                        role: ["user"]
                    },
                ]
            },
            {
                key: '/department/add',
                component: lazy(() => import('../page/one2')),
                title: '添加部门',
                icon: <UserOutlined />,
                role: ["user"]
            },
        ]
    },
    {
        title: '代码示例',
        component: lazy(() => import('../page/one3')),
        icon: <UserOutlined />,
        key: '/home/',
        role: ["information", "user"], // 角色 
        child: [{
            key: '/user/event',
            title: '事件监听(埋点)',
            component: lazy(() => import('../page/Listener')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/参数传递',
            title: '参数传递',
            component: lazy(() => import('../history/index_参数传递')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/常用示例',
            title: '常用示例',
            component: lazy(() => import('../history/index_常用示例')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/防抖',
            title: '防抖',
            component: lazy(() => import('../history/index_防抖')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/总结',
            title: '总结',
            component: lazy(() => import('../history/index_总结')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/复杂提交',
            title: '复杂提交',
            component: lazy(() => import('../history/index_form_复杂提交')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/更新卸载后的组件',
            title: '更新卸载后的组件',
            component: lazy(() => import('../history/index_bug_更新卸载后的组件')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/游戏',
            title: '游戏',
            component: lazy(() => import('../history/index_game')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/路由1',
            title: '路由1',
            component: lazy(() => import('../history/index_router_1')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/路由2',
            title: '路由2',
            component: lazy(() => import('../history/index_router_2')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/引用与值类型',
            title: '引用与值类型',
            component: lazy(() => import('../history/index_table_引用与值类型')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/useContext',
            title: 'useContext',
            component: lazy(() => import('../history/index_useContext')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/useMemo',
            title: 'useMemo',
            component: lazy(() => import('../history/index_useMemo')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/list1',
            title: 'list1',
            component: lazy(() => import('../page/list1')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/list2',
            title: 'list2',
            component: lazy(() => import('../page/list2')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/list3',
            title: 'list3',
            component: lazy(() => import('../page/list3')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        ]
    },
    {
        title: '笔记',
        // component: lazy(() => import('../page/markdown')),
        icon: <UserOutlined />,
        key: '/doc/',
        child: [{
            key: '/md/',
            title: 'md示例',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/vscode/',
            title: 'vscode插件',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/devDoc/',
            title: '开发手册',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/npm/',
            title: 'npm命令',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/css/',
            title: 'css',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        },
        {
            key: '/note/',
            title: '摘要',
            component: lazy(() => import('../page/markdown')),
            icon: <UserOutlined />,
            role: ["user"]
        }
        ]
    },
    {
        title: '其他',
        key: '/other/',
        component: lazy(() => import('../page/markdown')),
        icon: <UserOutlined />,

    }
]
export default config;